<?php
/**
 * User: bim bip
 * Date: 8/7/11
 * Time: 1:13 PM
 */
class Ad_Movie_Actor extends CI_Controller{
    function __construct(){
        parent::__construct();
        if(!$this->session->userdata('logged_in')){
            echo "You must refresh your browser to be continute!!!";
            die;
        }
    }

    function index(){
        if($this->input->post('new-submit')){
            $this->_addNew();
        }
        $this->load->model('movie/m_actor');
        $actor = new M_Actor();
        $data['list'] = $actor->getActorList();
        $this->load->view('manage/movie/actor', $data);
    }

    function _addNew(){
        $name = $this->input->post('name');
        if(trim($name) == '') return;
        else{
            //add new
            $this->load->model('movie/m_actor');
            $actor = new M_Actor();
            $actor->_name = $name;
            $actor->addNew();

            //delete cache
            $this->db->cache_delete('video', 'index');
        }
    }
    
}
